//data:obj,message:string

//返回的数据模型
// {
//     type: 0/-1 //成功失败的number
//     data: obj 
// }


class BaseModel {
    constructor(data,message) {
        if(typeof data === 'string') {
            this.message = data
            data = null
            message = null
        }
        if(data) {
            this.data = data
        }
        if(message) {
            this.message = message
        }
    }
}

class successModel extends BaseModel {
    constructor(data,message){
        super(data,message)
        this.type = 'success'
    }
}
class errorModel extends BaseModel {
    constructor(data,message) {
        super(data,message)
        this.type = 'error'
    }
}
module.exports = {
    successModel,
    errorModel
}